package com.ruoyi.bole.integral.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.bole.integral.domain.BoleIntegralSeason;
import com.ruoyi.bole.integral.service.IBoleIntegralSeasonService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;

import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 积分赛季Controller
 * 
 * @author wujiale
 * @date 2025-05-29
 */
@RestController
@RequestMapping("/bole/season")
public class BoleIntegralSeasonController extends BaseController
{
    @Autowired
    private IBoleIntegralSeasonService boleIntegralSeasonService;

    /**
     * 查询积分赛季列表
     */
//    @PreAuthorize("@ss.hasPermi('bole:season:list')")
    @GetMapping("/list")
    public TableDataInfo list(BoleIntegralSeason boleIntegralSeason)
    {
        startPage();
        List<BoleIntegralSeason> list = boleIntegralSeasonService.selectBoleIntegralSeasonList(boleIntegralSeason);
        return getDataTable(list);
    }

    /**
     * 导出积分赛季列表
     */
    @PreAuthorize("@ss.hasPermi('bole:season:export')")
    @Log(title = "积分赛季", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BoleIntegralSeason boleIntegralSeason)
    {
        List<BoleIntegralSeason> list = boleIntegralSeasonService.selectBoleIntegralSeasonList(boleIntegralSeason);
        ExcelUtil<BoleIntegralSeason> util = new ExcelUtil<BoleIntegralSeason>(BoleIntegralSeason.class);
        util.exportExcel(response, list, "积分赛季数据");
    }

    /**
     * 获取积分赛季详细信息
     */
    @PreAuthorize("@ss.hasPermi('bole:season:query')")
    @GetMapping(value = "/{seasonId}")
    public AjaxResult getInfo(@PathVariable("seasonId") Long seasonId)
    {
        return success(boleIntegralSeasonService.selectBoleIntegralSeasonBySeasonId(seasonId));
    }

    /**
     * 新增积分赛季
     */
    @PreAuthorize("@ss.hasPermi('bole:season:add')")
    @Log(title = "积分赛季", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BoleIntegralSeason boleIntegralSeason)
    {
        return toAjax(boleIntegralSeasonService.insertBoleIntegralSeason(boleIntegralSeason));
    }

    /**
     * 修改积分赛季
     */
    @PreAuthorize("@ss.hasPermi('bole:season:edit')")
    @Log(title = "积分赛季", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BoleIntegralSeason boleIntegralSeason)
    {
        return toAjax(boleIntegralSeasonService.updateBoleIntegralSeason(boleIntegralSeason));
    }

    /**
     * 删除积分赛季
     */
    @PreAuthorize("@ss.hasPermi('bole:season:remove')")
    @Log(title = "积分赛季", businessType = BusinessType.DELETE)
	@DeleteMapping("/{seasonIds}")
    public AjaxResult remove(@PathVariable Long[] seasonIds)
    {
        return toAjax(boleIntegralSeasonService.deleteBoleIntegralSeasonBySeasonIds(seasonIds));
    }
}
